package lab03.test11;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Test {
    public static void main(String[] args) throws SQLException {
        Connection connection = null;
        Statement statement = null;
        String sql = "insert into t_users(id,password)values(1,'admin')";
        String sql1 = "insert into t_users(id,password)values(2,'123456')";
        try {
            Class.forName("com.mysql.jdbc.Driver");
            try {
                connection = DriverManager.getConnection(
                        "jdbc:mysal://localhost:3306/java_2017?serverTimezone=UTC",
                        "root",
                        "123456"
                );
                statement = connection.createStatement();
                statement.execute(sql);
                statement.execute(sql1);
            } catch (SQLException e) {
                e.printStackTrace();
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        finally {
            statement.close();
            try {
                connection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}
